import util from '_util/index'
import tool from 'src/util/tool'

import Vue from 'vue'
import VueResource from 'vue-resource';

//let awaitme = require('await')
Vue.use(VueResource);
let vue = new Vue()
let cityNameLists = ''
let cityIdLists = ''
let cityAll = false
let url = '/user/limit/getCitys'
let param = {}


const actions = {
    addplus (context) {
        context.commit('add', 5)
    },
    jianplus ({
                  commit
              }) {
        commit('jian')
    },
    login () {

    },
    //初始化用户的城市列表
    initUserCitys({commit, state, rootState}, param){

        return util.getDataCom(vue, url, param, (rs) => {

            commit('initUserCitys', {list: rs, arg: param});

        });

    },
    get_all_model({commit, state}){


        let url = tool.getApi(null, 'Model');
        let param = {
            notParse: 1
        };
        util.getDataCom(vue, url, param, (rs) => {
            commit('setModelAll', rs);
        });


    }

}


export default actions
